<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../../js库/mock.js"></script>
    <script src="../../js库/vue.js"></script>
    <title>css叠放顺序</title>
    <style>
        /* 
            叠放次序
                定位布局时可能出现盒子重叠 此时用z-index来控制盒子的前后次序(z轴)
                 z-index: 2; 没有单位1默认为auto(后来居上)可以是 整数 0 数值越大越靠上
         */
         #root {
            height: 3000px;
            
         }
        .box {
            width: 700px;
            height: 700px;
            background-color: palevioletred;
            position: relative;
            
        }
        img {
            width: 100%;
            height: 100%;
        }
        div.img {
            width: 100px;
            height: 100px;
            position: absolute;
            top: 30px;
            left: 20px;
            /* z-index: 1; */
        }
        div.i2 {
            width: 50px;
            height: 50px;
            background-color: blue;
            position: relative;
            top: 10px;
            left: 10px;
    
            /* z-index: 2; */
        }
    </style>
</head>

<body>
    <div id="root">
        <div class="box">
                <div class="img">
                    <img src="../../picture/1.jpg" alt="">
                </div>
                <div class="i2">

                </div>
                <div class="i3" style="background-color: yellow; width: 30px;height: 30px;"></div>
        </div>
    </div>
</body>
<script>
    new Vue({
        el: '#root',
        data() {
            return {
            }
        },
    })
</script>

</html>